<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>IDA SDK: Segment selectors</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">IDA SDK
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.9.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="files.html"><span>Header&#160;Files</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Segment selectors<div class="ingroups"><a class="el" href="group__seg.html">Segments</a></div></div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>The kernel maintains a table to translate selector values to segment base paragraphs. </p>
<p>A Paragraph is a 16byte quantity. This table and translation is necessary because IBM PC uses 16bit selectors in instructions but segments may reside anywhere in the linear addressing space. For example, if a segment with selector 5 resides at 0x400000, we need to have selector translation 5 -&gt; 0x400000. For 16bit programs the selector translation table is usually empty, selector values are equal to segment base paragraphs. </p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:gad14f8b09f7f016cd4b179a4820129ecf"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gad14f8b09f7f016cd4b179a4820129ecf"></a>
<a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> bool <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__seg__sel.html#gad14f8b09f7f016cd4b179a4820129ecf">getn_selector</a> (<a class="el" href="pro_8h.html#a633a07e2920351503da14c0adcd3edfd">sel_t</a> *sel, <a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> *base, int n)</td></tr>
<tr class="memdesc:gad14f8b09f7f016cd4b179a4820129ecf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get description of selector (0..<a class="el" href="group__seg__sel.html#gabf03e7f51765884a04843fbb39f55152" title="Get number of defined selectors. ">get_selector_qty()</a>-1) <br /></td></tr>
<tr class="separator:gad14f8b09f7f016cd4b179a4820129ecf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gabf03e7f51765884a04843fbb39f55152"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gabf03e7f51765884a04843fbb39f55152"></a>
<a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> int <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__seg__sel.html#gabf03e7f51765884a04843fbb39f55152">get_selector_qty</a> (void)</td></tr>
<tr class="memdesc:gabf03e7f51765884a04843fbb39f55152"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get number of defined selectors. <br /></td></tr>
<tr class="separator:gabf03e7f51765884a04843fbb39f55152"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga95b819f125c442c7476c1a844cee22d5"><td class="memItemLeft" align="right" valign="top"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> <a class="el" href="pro_8h.html#a633a07e2920351503da14c0adcd3edfd">sel_t</a> <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__seg__sel.html#ga95b819f125c442c7476c1a844cee22d5">setup_selector</a> (<a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> segbase)</td></tr>
<tr class="memdesc:ga95b819f125c442c7476c1a844cee22d5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Allocate a selector for a segment if necessary.  <a href="#ga95b819f125c442c7476c1a844cee22d5">More...</a><br /></td></tr>
<tr class="separator:ga95b819f125c442c7476c1a844cee22d5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga0bc493dc34c0cc8268be321fc89a72fd"><td class="memItemLeft" align="right" valign="top"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> <a class="el" href="pro_8h.html#a633a07e2920351503da14c0adcd3edfd">sel_t</a> <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__seg__sel.html#ga0bc493dc34c0cc8268be321fc89a72fd">allocate_selector</a> (<a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> segbase)</td></tr>
<tr class="memdesc:ga0bc493dc34c0cc8268be321fc89a72fd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Allocate a selector for a segment unconditionally.  <a href="#ga0bc493dc34c0cc8268be321fc89a72fd">More...</a><br /></td></tr>
<tr class="separator:ga0bc493dc34c0cc8268be321fc89a72fd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gae9d8d263928e1700026ab15eabf10480"><td class="memItemLeft" align="right" valign="top"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> <a class="el" href="pro_8h.html#a633a07e2920351503da14c0adcd3edfd">sel_t</a> <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__seg__sel.html#gae9d8d263928e1700026ab15eabf10480">find_free_selector</a> (void)</td></tr>
<tr class="memdesc:gae9d8d263928e1700026ab15eabf10480"><td class="mdescLeft">&#160;</td><td class="mdescRight">Find first unused selector.  <a href="#gae9d8d263928e1700026ab15eabf10480">More...</a><br /></td></tr>
<tr class="separator:gae9d8d263928e1700026ab15eabf10480"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaee421bd585e301aea9452c84ac735c6a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> int <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__seg__sel.html#gaee421bd585e301aea9452c84ac735c6a">set_selector</a> (<a class="el" href="pro_8h.html#a633a07e2920351503da14c0adcd3edfd">sel_t</a> selector, <a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> paragraph)</td></tr>
<tr class="memdesc:gaee421bd585e301aea9452c84ac735c6a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set mapping of selector to a paragraph.  <a href="#gaee421bd585e301aea9452c84ac735c6a">More...</a><br /></td></tr>
<tr class="separator:gaee421bd585e301aea9452c84ac735c6a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga30f786fe1f285b2a2df2c7c6a18d57a9"><td class="memItemLeft" align="right" valign="top"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> void <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__seg__sel.html#ga30f786fe1f285b2a2df2c7c6a18d57a9">del_selector</a> (<a class="el" href="pro_8h.html#a633a07e2920351503da14c0adcd3edfd">sel_t</a> selector)</td></tr>
<tr class="memdesc:ga30f786fe1f285b2a2df2c7c6a18d57a9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Delete mapping of a selector.  <a href="#ga30f786fe1f285b2a2df2c7c6a18d57a9">More...</a><br /></td></tr>
<tr class="separator:ga30f786fe1f285b2a2df2c7c6a18d57a9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga8416e3237013eadfd32dfafc87953e3c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> <a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__seg__sel.html#ga8416e3237013eadfd32dfafc87953e3c">sel2para</a> (<a class="el" href="pro_8h.html#a633a07e2920351503da14c0adcd3edfd">sel_t</a> selector)</td></tr>
<tr class="memdesc:ga8416e3237013eadfd32dfafc87953e3c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get mapping of a selector.  <a href="#ga8416e3237013eadfd32dfafc87953e3c">More...</a><br /></td></tr>
<tr class="separator:ga8416e3237013eadfd32dfafc87953e3c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga0bf8f3ddf2be4616b37609bf3d302c8e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> <a class="el" href="pro_8h.html#a6505e7ff3b129d8b17258304886fd133">idaapi</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__seg__sel.html#ga0bf8f3ddf2be4616b37609bf3d302c8e">sel2ea</a> (<a class="el" href="pro_8h.html#a633a07e2920351503da14c0adcd3edfd">sel_t</a> selector)</td></tr>
<tr class="memdesc:ga0bf8f3ddf2be4616b37609bf3d302c8e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get mapping of a selector as a linear address.  <a href="#ga0bf8f3ddf2be4616b37609bf3d302c8e">More...</a><br /></td></tr>
<tr class="separator:ga0bf8f3ddf2be4616b37609bf3d302c8e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaf4a5a8ead1db6a02fe332395bb0f1e25"><td class="memItemLeft" align="right" valign="top"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> <a class="el" href="pro_8h.html#a633a07e2920351503da14c0adcd3edfd">sel_t</a> <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__seg__sel.html#gaf4a5a8ead1db6a02fe332395bb0f1e25">find_selector</a> (<a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> base)</td></tr>
<tr class="memdesc:gaf4a5a8ead1db6a02fe332395bb0f1e25"><td class="mdescLeft">&#160;</td><td class="mdescRight">Find a selector that has mapping to the specified paragraph.  <a href="#gaf4a5a8ead1db6a02fe332395bb0f1e25">More...</a><br /></td></tr>
<tr class="separator:gaf4a5a8ead1db6a02fe332395bb0f1e25"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga6e6e924cc3dd3971f5576a4569afc3c7"><td class="memItemLeft" align="right" valign="top"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> int <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__seg__sel.html#ga6e6e924cc3dd3971f5576a4569afc3c7">enumerate_selectors</a> (int(<a class="el" href="pro_8h.html#a6505e7ff3b129d8b17258304886fd133">idaapi</a> *func)(<a class="el" href="pro_8h.html#a633a07e2920351503da14c0adcd3edfd">sel_t</a> sel, <a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> para))</td></tr>
<tr class="memdesc:ga6e6e924cc3dd3971f5576a4569afc3c7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enumerate all selectors from the translation table.  <a href="#ga6e6e924cc3dd3971f5576a4569afc3c7">More...</a><br /></td></tr>
<tr class="separator:ga6e6e924cc3dd3971f5576a4569afc3c7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga9500c2b6c5a4a9e32b30926e92979d1f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> <a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__seg__sel.html#ga9500c2b6c5a4a9e32b30926e92979d1f">enumerate_segments_with_selector</a> (<a class="el" href="pro_8h.html#a633a07e2920351503da14c0adcd3edfd">sel_t</a> selector, <a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a>(<a class="el" href="pro_8h.html#a6505e7ff3b129d8b17258304886fd133">idaapi</a> *func)(<a class="el" href="classsegment__t.html">segment_t</a> *s, void *ud), void *ud=NULL)</td></tr>
<tr class="memdesc:ga9500c2b6c5a4a9e32b30926e92979d1f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enumerate all segments with the specified selector.  <a href="#ga9500c2b6c5a4a9e32b30926e92979d1f">More...</a><br /></td></tr>
<tr class="separator:ga9500c2b6c5a4a9e32b30926e92979d1f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga18c1993675118da58f537e441edb4a66"><td class="memItemLeft" align="right" valign="top"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> <a class="el" href="classsegment__t.html">segment_t</a> *<a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__seg__sel.html#ga18c1993675118da58f537e441edb4a66">get_segm_by_sel</a> (<a class="el" href="pro_8h.html#a633a07e2920351503da14c0adcd3edfd">sel_t</a> selector)</td></tr>
<tr class="memdesc:ga18c1993675118da58f537e441edb4a66"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get pointer to segment structure.  <a href="#ga18c1993675118da58f537e441edb4a66">More...</a><br /></td></tr>
<tr class="separator:ga18c1993675118da58f537e441edb4a66"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="ga95b819f125c442c7476c1a844cee22d5"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> <a class="el" href="pro_8h.html#a633a07e2920351503da14c0adcd3edfd">sel_t</a> <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a> setup_selector </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a>&#160;</td>
          <td class="paramname"><em>segbase</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Allocate a selector for a segment if necessary. </p>
<p>You must call this function before calling <a class="el" href="group__seg__man.html#ga9c959024724f499c3c1b3c2ddb1f63b4" title="Add a new segment. ">add_segm_ex()</a>. <a class="el" href="group__seg__man.html#ga59f6ee9677c2605aeac9541e38e54025" title="Add a new segment, second form. ">add_segm()</a> calls this function itself, so you don't need to allocate a selector. This function will allocate a selector if 'segbase' requires more than 16 bits and the current processor is IBM PC. Otherwise it will return the segbase value. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">segbase</td><td>a new segment base paragraph </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the allocated selector number </dd></dl>

</div>
</div>
<a class="anchor" id="ga0bc493dc34c0cc8268be321fc89a72fd"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> <a class="el" href="pro_8h.html#a633a07e2920351503da14c0adcd3edfd">sel_t</a> <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a> allocate_selector </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a>&#160;</td>
          <td class="paramname"><em>segbase</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Allocate a selector for a segment unconditionally. </p>
<p>You must call this function before calling <a class="el" href="group__seg__man.html#ga9c959024724f499c3c1b3c2ddb1f63b4" title="Add a new segment. ">add_segm_ex()</a>. <a class="el" href="group__seg__man.html#ga59f6ee9677c2605aeac9541e38e54025" title="Add a new segment, second form. ">add_segm()</a> calls this function itself, so you don't need to allocate a selector. This function will allocate a new free selector and setup its mapping using <a class="el" href="group__seg__sel.html#gae9d8d263928e1700026ab15eabf10480" title="Find first unused selector. ">find_free_selector()</a> and <a class="el" href="group__seg__sel.html#gaee421bd585e301aea9452c84ac735c6a" title="Set mapping of selector to a paragraph. ">set_selector()</a> functions. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">segbase</td><td>a new segment base paragraph </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the allocated selector number </dd></dl>

</div>
</div>
<a class="anchor" id="gae9d8d263928e1700026ab15eabf10480"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> <a class="el" href="pro_8h.html#a633a07e2920351503da14c0adcd3edfd">sel_t</a> <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a> find_free_selector </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Find first unused selector. </p>
<dl class="section return"><dt>Returns</dt><dd>a number &gt;= 1 </dd></dl>

</div>
</div>
<a class="anchor" id="gaee421bd585e301aea9452c84ac735c6a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> int <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a> set_selector </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="pro_8h.html#a633a07e2920351503da14c0adcd3edfd">sel_t</a>&#160;</td>
          <td class="paramname"><em>selector</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a>&#160;</td>
          <td class="paramname"><em>paragraph</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set mapping of selector to a paragraph. </p>
<p>You should call this function _before_ creating a segment which uses the selector, otherwise the creation of the segment will fail. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">selector</td><td>number of selector to map<ul>
<li>if selector == <a class="el" href="pro_8h.html#a893ddf307fae0a3bbca667ee917cddc7" title="&#39;bad selector&#39; value ">BADSEL</a>, then return 0 (fail)</li>
<li>if the selector has had a mapping, old mapping is destroyed</li>
<li>if the selector number is equal to paragraph value, then the mapping is destroyed because we don't need to keep trivial mappings. </li>
</ul>
</td></tr>
    <tr><td class="paramname">paragraph</td><td>paragraph to map selector </td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">1</td><td>ok </td></tr>
    <tr><td class="paramname">0</td><td>failure (bad selector or too many mappings) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ga30f786fe1f285b2a2df2c7c6a18d57a9"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> void <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a> del_selector </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="pro_8h.html#a633a07e2920351503da14c0adcd3edfd">sel_t</a>&#160;</td>
          <td class="paramname"><em>selector</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Delete mapping of a selector. </p>
<p>Be wary of deleting selectors that are being used in the program, this can make a mess in the segments. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">selector</td><td>number of selector to remove from the translation table </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ga8416e3237013eadfd32dfafc87953e3c"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> <a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a> sel2para </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="pro_8h.html#a633a07e2920351503da14c0adcd3edfd">sel_t</a>&#160;</td>
          <td class="paramname"><em>selector</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get mapping of a selector. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">selector</td><td>number of selector to translate </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>paragraph the specified selector is mapped to. if there is no mapping, returns 'selector'. </dd></dl>

</div>
</div>
<a class="anchor" id="ga0bf8f3ddf2be4616b37609bf3d302c8e"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> <a class="el" href="pro_8h.html#a6505e7ff3b129d8b17258304886fd133">idaapi</a> sel2ea </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="pro_8h.html#a633a07e2920351503da14c0adcd3edfd">sel_t</a>&#160;</td>
          <td class="paramname"><em>selector</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Get mapping of a selector as a linear address. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">selector</td><td>number of selector to translate to linear address </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>linear address the specified selector is mapped to. if there is no mapping, returns to_ea(selector,0); </dd></dl>

</div>
</div>
<a class="anchor" id="gaf4a5a8ead1db6a02fe332395bb0f1e25"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> <a class="el" href="pro_8h.html#a633a07e2920351503da14c0adcd3edfd">sel_t</a> <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a> find_selector </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a>&#160;</td>
          <td class="paramname"><em>base</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Find a selector that has mapping to the specified paragraph. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>paragraph to search in the translation table </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>selector value or base </dd></dl>

</div>
</div>
<a class="anchor" id="ga6e6e924cc3dd3971f5576a4569afc3c7"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> int <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a> enumerate_selectors </td>
          <td>(</td>
          <td class="paramtype">int(<a class="el" href="pro_8h.html#a6505e7ff3b129d8b17258304886fd133">idaapi</a> *)(<a class="el" href="pro_8h.html#a633a07e2920351503da14c0adcd3edfd">sel_t</a> sel, <a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> para)&#160;</td>
          <td class="paramname"><em>func</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Enumerate all selectors from the translation table. </p>
<p>This function calls 'func' for each selector in the translation table. If 'func' returns non-zero code, enumeration is stopped and this code is returned. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">func</td><td>callback function<ul>
<li>sel: selector number</li>
<li>para: selector mapping </li>
</ul>
</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 or code returned by 'func'. </dd></dl>

</div>
</div>
<a class="anchor" id="ga9500c2b6c5a4a9e32b30926e92979d1f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> <a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a> enumerate_segments_with_selector </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="pro_8h.html#a633a07e2920351503da14c0adcd3edfd">sel_t</a>&#160;</td>
          <td class="paramname"><em>selector</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a>(<a class="el" href="pro_8h.html#a6505e7ff3b129d8b17258304886fd133">idaapi</a> *)(<a class="el" href="classsegment__t.html">segment_t</a> *s, void *ud)&#160;</td>
          <td class="paramname"><em>func</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>ud</em> = <code>NULL</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Enumerate all segments with the specified selector. </p>
<p>This function will call the callback function 'func' for each segment that has the specified selector. Enumeration starts from the last segment and stops at the first segment (reverse order). If the callback function 'func' returns a value != <a class="el" href="pro_8h.html#a63a7c1cde5fb0cf0d0023d55c742dd4f" title="this value is used for &#39;bad address&#39; ">BADADDR</a>, the enumeration is stopped and this value is returned to the caller. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">selector</td><td>segments that have this selector are enumerated </td></tr>
    <tr><td class="paramname">func</td><td>callback function<ul>
<li>s: pointer to segment structure</li>
<li>ud: user data </li>
</ul>
</td></tr>
    <tr><td class="paramname">ud</td><td>pointer to user data. this pointer will be passed to the callback function </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="pro_8h.html#a63a7c1cde5fb0cf0d0023d55c742dd4f" title="this value is used for &#39;bad address&#39; ">BADADDR</a> or the value returned by the callback function 'func' </dd></dl>

</div>
</div>
<a class="anchor" id="ga18c1993675118da58f537e441edb4a66"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> <a class="el" href="classsegment__t.html">segment_t</a>* <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a> get_segm_by_sel </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="pro_8h.html#a633a07e2920351503da14c0adcd3edfd">sel_t</a>&#160;</td>
          <td class="paramname"><em>selector</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get pointer to segment structure. </p>
<p>This function finds a segment by its selector. If there are several segments with the same selectors, the last one will be returned. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">selector</td><td>a segment with the specified selector will be returned </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>pointer to segment or NULL </dd></dl>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
</body>
</html>
